<template>
  <div>
    <el-dialog :title="'织物全流程追溯'" :visible.sync="addEditIsDialog_c" @close="resetForm('formName')" width="1000px">
      <NxTable :table-cols="tableCols" :table-data="tableData" :pag-ination="pagination" class="table-wrap"> </NxTable>
      <div slot="footer" class="dialog-footer">
        <el-button @click="resetForm('formName')">关 闭</el-button>
        <!-- <el-button type="primary" @click="submitForm('formName')">确 定</el-button> -->
      </div>
    </el-dialog>
  </div>
</template>
<script type="text/ecmascript-6">
import { clothLogList } from "@/api/clothes";
import NxTable from "@/components/NxTable.vue";
import { Page } from "@/utils/pagination";

export default {
  components: {
    NxTable
  },
  props: {
    addEditId: {
      type: String,
      default: "",
    },
    addEditStatus: {
      type: String,
      default: "add",
    },
    addEditIsDialog: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      // 表头样式
      tabHeadStyle: {
        "background-color": "#f5f7fa",
        color: "#303133",
        "font-weight": "bold",
        "text-align": "center",
      },
      // 行样式
      tabcellStyle: {
        color: "#666",
      },
      rowStyle: {
        height: "16px",
      },
      pagesForm: {
        page: 1,
        limit: 10,
      },
      // 表格字段
      tableCols: [
        {
          label: "时间",
          prop: "create_time",
          align: "center",
        },
        {
          label: "操作",
          prop: "state",
          align: "center",
        },
        {
          label: "人员",
          prop: "operator",
          align: "center",
        },
        {
          label: "工号",
          prop: "no",
          align: "center",
        }
      ],
      tableData: [],
      pagination: new Page(),
      addEditIsDialog_c: false, // 弹窗是否显示
      seeType: false, // 是否禁用
      typeArray: [],
      activeId: '',
    };
  },
  watch: {
    addEditIsDialog(val) {
      this.addEditIsDialog_c = val;
      if (this.addEditIsDialog_c) {
        // 添加
        if (this.addEditStatus == "add") {
          this.seeType = false;
        }

        // 编辑
        if (this.addEditStatus == "edit") {
          this.seeType = false;
          this.getDetail();
        }

        // 查看
        if (this.addEditStatus == "see") {
          this.seeType = true;
          this.getDetail();
        }

      }
    }
  },
  methods: {
    // 详情
    getDetail() {
      clothLogList(this.pagesForm,{ id: this.addEditId }).then((res) => {
        if (res.code == 200) {
          this.tableData = res.data;
        }
      });
    },
    // 取消
    resetForm(formName) {
      this.$parent.closeAddEdit();
    },
  },
};
</script>

<style lang="less" scoped>
.demo-ruleForm {
  width: 95%;
  margin: 0 auto;
  padding-top: 10px;
}
.main {
  width: 100%;
  height: 100%;
  display: flex;
}
.card-item {
  width: 100%;
  height: 40px;
  line-height: 40px;
  cursor: pointer;
  border-bottom: solid 1px #f2f2f2;
  display: flex;
  justify-content: space-between;
  padding: 0px 10px;
}
// .card-item:hover{
//   background-color: #e8e8e8;
// }
.active {
  background-color: #d5e5e4;
}
.twoClass {
  display: flex;
  align-items: center;
  border: 1px solid #ebeef5;
}
.oneBox {
  // margin-left: 30px;
  // height: 15.62rem;
  // overflow: auto;
}
.twoBox {
  margin-left: 50px;
  display: flex;
  flex-direction: column;
  padding: 10px 10px;
}
.threeClass {
  display: flex;
  align-items: center;
  border: 1px solid #ebeef5;
}
.fourClass {
  display: flex;
  align-items: center;
  margin-top: 5px;
  // border: 1px solid #ebeef5;
}
.twocheckbox {
  width: 100px;
  display: flex;
  flex-direction: column;
  margin-left: 20px;
}
.threeBox {
  margin-left: 60px;
  margin-right: 30px;
  margin-bottom: 5px;
}
.trecheckbox {
  margin-left: 20px;
  margin-right: 20px;
  // display: flex;
  // flex-direction: column;
}
.box-card1 {
  width: 300px;
  height: 400px;
  margin-left: 90px;
}
</style>
